package com.bidepan.特殊类型注入;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestStudent {
    //map类型注入
    @Test
    public void test(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-di-map.xml");
        Student student = context.getBean("student",Student.class);
        student.run();
    }

    //通过util引入注入List和Map
    @Test
    public void test2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-di-list.xml");
        Student student = context.getBean("student2",Student.class);
        student.run();
    }
    //通过p-namespace简化写法
    @Test
    public void test3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean-di-Ref.xml");
        Student student = context.getBean("studentP",Student.class);
        student.run();
    }
}
